package com.starblink.android.guang.widget.cstnavbar

import android.app.Activity
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.AppCompatImageView
import androidx.recyclerview.widget.RecyclerView
import com.starblink.android.guang.R
import com.youth.banner.adapter.BannerAdapter
import java.util.ArrayList

/**
 * @author dyhpc
 */
class FirstNavBtnAdapter(mDatas: ArrayList<Int>, var context: Context) :
    BannerAdapter<Int, FirstNavBtnAdapter.BannerViewHolder>(mDatas) {
    //创建ViewHolder，可以用viewType这个字段来区分不同的ViewHolder
    override fun onCreateHolder(parent: ViewGroup, viewType: Int): BannerViewHolder {
        val view =
            LayoutInflater.from(context).inflate(R.layout.item_first_nav_btn, parent, false)
        return BannerViewHolder(view)
    }


    inner class BannerViewHolder(view: View) : RecyclerView.ViewHolder(view) {
        var img: AppCompatImageView

        init {
            img = view.findViewById(R.id.nav_img_1)
        }
    }

    override fun onBindView(holder: BannerViewHolder, data: Int, position: Int, size: Int) {
        holder.img.setImageResource(data)
    }
}